package com.graduate.controller;

import com.graduate.dao.UserMapper;
import com.graduate.model.User;
import com.graduate.service.LoginService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.List;


/**
 * Created by Administrator on 2017/10/23.
 */
@Controller
public class LoginCotroller {
     @Resource
    private LoginService loginService;
    @Resource
    private UserMapper userMapper;
    @RequestMapping("Login")
    @ResponseBody
    public Boolean Login(@RequestParam("username")String username,
                         @RequestParam("password") String password){
        System.out.print(username+password);
        Boolean flag;
        flag=loginService.LoginMathod(username,password);
        System.out.print(flag);
            return flag;
    }

    @RequestMapping("select")
    public @ResponseBody  List<User>  Select(){
        System.out.print("-------------------------");
        List<User> list=  userMapper.AllInfo();

      /*  for (User user:list){
            System.out.print(user.getUsername());
        }*/
        return  list;
    }





}
